<template>
    <el-dialog append-to-body :close-on-click-modal="false" :before-close="cancel" :visible.sync="visible" title="知情同意书"
        width="1000px">
        <div class="content">
            <div class="head-container">
                <div class="table_title">
                    {{ info.patientName }}
                    {{ info.gender == 0 ? "女" : info.gender == 1 ? "男" : "" }}
                    {{ info.age }}岁 {{ info.admissionNum || info.outpatientNum }}
                </div>
            </div>
            <div class="info">
                <div class="info_main">
                    <div class="main">
                        <div class="title">（高压氧治疗）</div>
                        <div class="text">
                            这是一份关于<span class="txt">高压氧治疗</span>的知情同意书，医生会用通俗易懂的方式告知该诊疗相关事宜。
                        </div>
                        <div class="item">
                            <span class="label">目前诊断：</span>
                            1.偏瘫(右侧) 2.气管造口状态 3.脑出血术后 4.高血压病 5.肺部感染
                            6.多形性红斑 7.2型糖尿 病 8.肝占位性病变 9.痛风
                        </div>
                        <div class="item">
                            <div class="label">检查及治疗目的：</div>
                            <span class="indent" v-for="(item, index) in hzInfo.treatmentTarget" :key="index">
                                <el-checkbox style="margin:0 5px" v-model="item.float" disabled></el-checkbox>
                                <span>{{ index + 1 }}、{{ item.itemName }}</span>
                            </span>
                        </div>
                        <div class="item">
                            <div class="label">主要意外、风险及并发症：</div>
                            <div class="indent" v-for="(item, index) in hzInfo.coreRisk" :key="index">
                                <el-checkbox style="margin:0 5px" v-model="item.float" disabled></el-checkbox>
                                <span>{{ index + 1 }}、{{ item.itemName }}</span>
                            </div>
                        </div>
                        <div class="item">
                            <div class="label">防范措施：</div>
                            <div v-html="measure"></div>
                        </div>
                    </div>
                    <a-descriptions class="footer">
                        <a-descriptions-item label="患者签名">{{
                            hzInfo.signName
                            }}</a-descriptions-item>
                        <a-descriptions-item label="患方指纹" :span="2">{{
                            hzInfo.fingerprint
                            }}</a-descriptions-item>
                        <a-descriptions-item label="与患者关系" :span="2">
                            {{ hzInfo.dicPatientRelation }}
                        </a-descriptions-item>
                        <a-descriptions-item label="签名时间">{{
                            hzInfo.createTime
                            }}</a-descriptions-item>
                    </a-descriptions>
                </div>
            </div>
        </div>

    </el-dialog>
</template>

<script>
import { searchDic } from "@/api/treatmentProject/treatments";
import moment from "moment";
export default {
    name: "infoForm",
    data() {
        return {
            visible: false,
            info: {},
            hzInfo: {},
            measure:
                "1、严格按照诊疗操作规范执行。<br />2、为了保证治疗安全,新病人高压氧治疗前三天需常规心电监护监测,如有异常需医生评估后决定。危重患者及生命体征不稳定的患者,需要常规持续监护。<br />3、加强监测,仔细操作,及时处理。<br />4、其他:必须知晓和严格遵守高压氧安全治疗的如下规定:<br />&nbsp;&nbsp;①病人进舱治疗必须服从医护人员的交排和指导,共同完成治疗任务<br />&nbsp;&nbsp;②严禁将火柴、打火机、收音机、助听器、电子表、手机等一切可能引起火花的物品带入舱内。<span style='font-weight:700'>除上述物品外病人及陪同入舱人员一律穿医院定制的全棉衣裤,自己的的衣裤严禁穿、带入舱内,包括女性患者的胸罩及男女性患者的短裤和袜子。患者治疗前必须清洗头发,采清除发油、发胶、口红、指甲油等化妆品。</span>有创口的患者禁用油类敷料。<br /> &nbsp;&nbsp;③病人进舱前必须做好准备工作:如解好大、小便,正确掌握吞咽及鼓鼻子的衡压动作。<br />&nbsp;&nbsp;④病人及陪舱人员在舱内治疗时,不准随便吐痰及乱丢果皮纸屑,保持舱内卫生,避免病菌传染。<br />&nbsp;&nbsp;⑤舱内设各不准随意乱动,如有损坏,照价赔偿设备及其人工组佳修和校验费用",
            mainRisksOption: [
                {
                    itemName:
                        "压力不适应诱发中耳炎，发生中耳、副鼻实气压伤，正常耳朵听力的一过性下降。",
                    itemId: "1",
                },
                {
                    itemName: "个体差异引起的氧过敏、氧中毒、减压病等。",
                    itemId: "2",
                },
                {
                    itemName:
                        "昏迷、癫痫、哮喘或者普通病人在减压时呼吸不当引起的肺气压伤;昏迷、咳嗽反射差的病人因呕吐物、痰液或其它分泌物堵塞气道导致室息。",
                    itemId: "3",
                },
                {
                    itemName: "新近手术病人出现切口部位皮下气肿，胸科病人引起气胸。",
                    itemId: "4",
                },
                {
                    itemName: "颇底骨骨折病人出现气颅或脑出血。",
                    itemId: "5",
                },
                {
                    itemName:
                        "脑梗塞病人由于血压波动引起脑出血或再发脑梗塞;脑出血病人出血范围扩大或新发脑出血。",
                    itemId: "6",
                },
                {
                    itemName:
                        "冠心病、房颤或者颈部、四肢血管壁上有斑块附着的患者，发生斑块脱落和心、肺、脑血管栓塞，导致冠心病复发、肺栓塞，脑卒中等，严重时直接危及生命。",
                    itemId: "7",
                },
                {
                    itemName:
                        "有心肺疾病或者潜在性心肺疾病的患者在舱内突发呼吸、心跳骤停，危及生命。",
                    itemId: "8",
                },
                {
                    itemName:
                        "患者在舱内突发癞痫，哮喘患者舱内突发哮喘，鼓膜畸形或损伤患者突发鼓膜穿孔。",
                    itemId: "9",
                },
                {
                    itemName:
                        "高压氧对患儿的视神经有一定的毒性作用，有可能导致患儿双目失明。",
                    itemId: "10",
                },
                {
                    itemName:
                        "在高压氧治疗过程中，也可能发生非高压氧因素导致的原发病复发，如脑卒中、冠心病，心律失常、癫痫、哮喘、自发性气胸等。",
                    itemId: "11",
                },
                {
                    itemName: "其他不可预料的意外、风险及并发症的发生。",
                    itemId: "12",
                },
                {
                    itemName: "以上情况可能较轻，也可能很重，甚至导致残疾或者死亡。",
                    itemId: "13",
                },
            ],
            relationshipOption: [],
            trageList: [
                {
                    itemName: "明确病因,完善诊断",
                    itemId: "1",
                },
                {
                    itemName: "确定治疗方案，判断预后",
                    itemId: "2",
                },
                {
                    itemName: "对症治疗，缓解病情",
                    itemId: "3",
                },
                {
                    itemName: "其他",
                    itemId: "4",
                },
            ],
        };
    },
    mounted() { },
    methods: {
        async showModal(data) {
            this.visible = true;
            this.info = data.activeRow;
            let _data = data.activeRow2.treatmentInformedInfo;
            this.hzInfo = {
                ..._data,
                treatmentTarget: _data.treatmentTarget
                    ? this.getArr(_data.treatmentTarget.split(","), this.trageList)
                    : [],
                coreRisk: _data.coreRisk
                    ? this.getArr(_data.coreRisk.split(","), this.mainRisksOption)
                    : [],
                createTime: _data.createTime
                    ? moment(_data.createTime).format("YYYY年MM月DD日 HH:mm:ss")
                    : "",
                dicPatientRelation: _data.dicPatientRelation
                    ? this.getLabel(_data.dicPatientRelation)
                    : "",
            };
            await this.getOption();
        },
        cancel() {
            this.visible = false;
        },
        async getOption() {
            await searchDic({ dicCode: "dicPatientRelation" }).then((res) => {
                this.relationshipOption =
                    res.content && res.content.length > 0 ? res.content[0].itemList : [];
            });
        },
        getArr(ids, arr) {
            let data = arr.map((item) => {
                return {
                    ...item,
                    float: ids.includes(item.itemId),
                };
            });
            return data;
        },
        getLabel(val) {
            let obj = this.relationshipOption.find((item) => {
                return item.itemId == val;
            });
            return obj ? obj.itemName : "";
        },
    },
};
</script>

<style lang="scss" scoped>
/deep/.crud-opts {
    display: inline-flex;
}

.content {
    color: #303133;
}

.table_title {
    display: inline-block;
    line-height: 30px;
    vertical-align: middle;
    font-weight: bold;
    color: #303133;
    font-size: 15px;
}

.head-container {
    margin-left: 20px;
}

.info {
    display: flex;
    justify-content: center;

    .info_main {
        width: 80%;

        .label {
            font-weight: 700;
        }

        .text {
            text-indent: 2em;
        }

        .txt {
            text-decoration: underline;
        }

        .footer {
            margin-top: 10px;
        }

        .title {
            display: flex;
            justify-content: center;
            font-size: 16px;
            font-weight: 700;
        }

        .main {
            height: 500px;
            overflow: auto;
        }
    }
}
</style>
